
var mychart1 =echarts.init(document.getElementById('charts1'));
var mychart2 = echarts.init(document.getElementById('charts2'));
var mychart3 =echarts.init(document.getElementById('charts3'));
var mychart4 =echarts.init(document.getElementById('charts4'));

var option1,option2,option3,option4;



/*var waterMarkText = 'ECHARTS';*/

var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width = canvas.height = 100;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.globalAlpha = 0.08;
ctx.font = '20px Microsoft Yahei';
ctx.translate(50, 50);
ctx.rotate(-Math.PI / 4);
var textColor = '#fff';
/*ctx.fillText(waterMarkText, 0, 0);*/



var url = "/ajax/ShowAjax/depart_number";
var urlGood = "http://localhost:2018/ajax/ImpPosAjax/depart_static_good";
var monthData = [];         //图二，某年每个月数据
var years = [];             //某年
var builderJson = {
    "charts": {
        "人事部": 305,
        "财政部": 442,
        "民政部": 590,
        "技术部": 662,
        "工商部": 760,
        "卫生部": 837,
        "交通部": 908,
        "教育部": 1107,
        "劳动部": 1292,
        "公安部": 1568
    },
    "components": {
        "人事部": 210,
        "财政部": 269,
        "民政部": 341,
        "技术部": 389,
        "工商部": 421,
        "卫生部": 532,
        "交通部": 645,
        "教育部": 987,
        "劳动部": 1211,
        "公安部": 1541
    },
    "ie": 9743
};





//自动滚动
function autoAction(mychart,total){
    var tooltip = mychart.tooltip;
    var obj = {"mychart":mychart,"total":total,"timer":0,"count":0}


    autoTip(obj);

    var zRender = mychart.getZr();
//mousemove和mouseout总是成对出现，而且out先出现。。。。所以没法解决鼠标hover时暂停自动tip的效果
    zRender.on('mousemove', function (param) {
        console.log('move')
        if (obj.timer) {
            clearInterval(obj.timer);
            obj.timer = 0;
        }
    });
    zRender.on('mouseout', function (param) {
        console.log('OUT');
        if (param.event) {
            //判断坐标是否在图表上，然后在处理应该可以实现
            if (!obj.timer) {
                autoTip(obj);
            }
        }
    });
}
function autoTip(obj) {
    obj.timer = setInterval(function () {
        var curr = obj.count % obj.total;

        //3.0以上版本的showTip使用方式
        obj.mychart.dispatchAction({type: 'showTip', seriesIndex: 0, dataIndex: curr});
        //tooltip.showTip({seriesIndex: '0', dataIndex: curr});
        obj.count += 1;
    }, 1500);
}

function countNumer(){
    var options = {
        useEasing: true,
        useGrouping: true,
        separator: ',',
        decimal: '.',
    };
     count_number1 = new CountUp('count-number1', 0, 0, 0, 1.5, options);
     count_number2 = new CountUp('count-number2', 0, 0, 0, 1.5, options);
     count_number3 = new CountUp('count-number3', 0, 0, 0, 1.5, options);
     count_number4 = new CountUp('count-number4', 0, 0, 0, 1.5, options);

    count_number1.start();
    count_number2.start();
    count_number3.start();
    count_number4.start();

}


$(window).ready(function () {
    var id = 9;

    $.getJSON(url,"id="+id,function (value) {
        years = value.years;
        years.forEach(function(item) {
            var send_month = [0,0,0,0,0,0,0,0,0,0,0,0];
            var over_month = [0,0,0,0,0,0,0,0,0,0,0,0];

            value.months['send_'+item].forEach(function(d){
                send_month[d[0]-1] = d[1];
            });
            value.months['over_'+item].forEach(function(d){
                over_month[d[0]-1] = d[1];
            });
            monthData.push({
                series : [
                    {
                        name:'上报数',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                show: true,
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#7049f0'
                                }, {
                                    offset: 1,

                                    color: '#9A32CD'
                                }]),
                                /*  barBorderRadius: 15,
                                  borderWidth: 0,*/
                            }
                        },
                        data:send_month,
                        markPoint : {
                            data : [
                                {type : 'max', name: '最大值'},
                                {type : 'min', name: '最小值'}
                            ]
                        },
                        markLine : {
                            data : [
                                {type : 'average', name: '平均值'}
                            ]
                        }
                    },
                    {
                        name:'结案数',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                /*     barBorderRadius: 15,*/
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1, [{
                                        offset: 0,
                                        color: '#00feff'
                                    },
                                        {
                                            offset: 0.5,
                                            color: '#027eff'
                                        },
                                        {
                                            offset: 1,
                                            color: '#0286ff'
                                        }
                                    ]
                                )
                            }
                        },
                        data:over_month,
                        markPoint : {
                            data : [
                                {name : '年最高', value : 182.2, xAxis: 7, yAxis: 183},
                                {name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
                            ]
                        },
                        markLine : {
                            data : [
                                {type : 'average', name : '平均值'}
                            ]
                        }
                    }
                ]
            })
        });

         option1 = {
            /*backgroundColor:'#fff',*/
            tooltip: { },
            series: [
                {
                name: '上报率',
                type: 'pie',
                radius: ['40%', '55%'],
                center:['80%','50%'],
                /*color:'#C23531',*/
                itemStyle:{
                    normal:{
                        color:new echarts.graphic.LinearGradient(
                            0,0,0,1,
                            [
                                {offset:0, color: '#00b0ff'},
                                {offset:0.8, color: '#7052f4'},

                            ]
                        )
                    }
                },
                label: {
                    normal: {
                        position: 'center'
                    }
                },
                data: [
                    {
                    value: value.report_over,
                    name: '上报数',
                    label: {
                        normal: {
                            formatter: '{d} %',
                            textStyle: {
                                fontSize: 18,
                                color:'#027eff'
                            }
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=({b}/上报数)*100%<br/> 上报数 : {c}"
                    }
                },
                    {
                    value: value.report_send+value.report_accept,
                    name: '未上报数',
                    label: {
                        normal: {
                            formatter: '\n完成上报',
                            textStyle:{
                                color:'#027eff'
                            },
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=(未上报数/事件发生数)*100%<br/> {b} : {c}"
                    },
                    itemStyle: {
                        normal: {
                            color: '#DBDBDB'
                        },
                        emphasis: {
                            color: '#DBDBDB'
                        }
                    },
                }
                ]
            },
                {
                name: '处理率',
                type: 'pie',
                radius: ['40%', '55%'],
                center:['50%','50%'],
                itemStyle:{
                    normal:{
                        color:new echarts.graphic.LinearGradient(
                            0,0,0,1,
                            [
                                {offset:0, color: '#00b0ff'},
                                {offset:0.8, color: '#4CC76D'},

                            ]
                        )
                    }
                },
                label: {
                    normal: {
                        position: 'center'
                    }
                },
                data: [
                    {
                    value: value.report_accept,
                    name: '处理率',

                    label: {
                        normal: {
                            formatter: '{d} %',
                            textStyle: {
                                fontSize: 18,
                                color:'#027eff'
                            }
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=({b}/事件处理数)*100%<br/> 事件处理数 : {c}"
                    }
                }, {
                    value: value.report_send,
                    name: '未处理数',
                    label: {
                        normal: {
                            formatter: '\n未处理率',
                            textStyle:{
                                color:'#027eff'
                            },
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=(未处理数/事件发生数)*100%<br/> {b} : {c}"
                    },
                    itemStyle: {
                        normal: {
                            color: '#DBDBDB'
                        },
                        emphasis: {
                            color: '#DBDBDB'
                        }
                    },
                }]
            },{
                name: '结案率',
                type: 'pie',
                radius: ['40%', '55%'],
                center:['20%','50%'],
                itemStyle:{
                    normal:{
                        color:new echarts.graphic.LinearGradient(
                            0,0,0,1,
                            [
                                {offset:0, color: '#00b0ff'},
                                {offset:0.8, color: '#96d668'},

                            ]
                        )
                    }
                },
                label: {
                    normal: {
                        position: 'center'
                    }
                },
                data: [{
                    value: value.report_over,
                    name: '结案数',
                    label: {
                        normal: {
                            formatter: '{d} %',
                            textStyle: {
                                fontSize: 18,
                                color:'#027eff'
                            }
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=({b}/结案数)*100%<br/> 结案数 : {c}"
                    }

                }, {
                    value: value.report_send+value.report_accept,
                    name: '未结案数',
                    label: {
                        normal: {
                            formatter: '\n未结案数',
                            textStyle:{
                                color:'#027eff'
                            },
                        }
                    },
                    tooltip:{
                        trigger: 'item',
                        formatter: "{a}=(未结案数/事件发生率)*100%<br/> {b} : {c}"
                    },
                    itemStyle: {
                        normal: {
                            color: '#DBDBDB'
                        },
                        emphasis: {
                            color: '#DBDBDB'
                        }
                    },
                }]
            }]
        };
         option2 = {
            baseOption:{
                timeline: {
                    axisType: 'category',
                    orient: 'horizontal',
                    autoPlay: true,
                    inverse: true,
                    playInterval: 40000,
                    label: {
                        show:true,

                        normal: {
                            position:'bottom',
                            textStyle: {
                                color: '#fff'
                            }
                        },
                        emphasis: {
                            textStyle: {
                                color: '#188df0'
                            }
                        }
                    },
                    symbol: 'none',
                    lineStyle: {
                        color: '#ddd'
                    },
                    checkpointStyle: {
                        color: '#fff',
                        borderColor: '#188df0',
                        borderWidth: 2
                    },
                    controlStyle: {
                        showNextBtn: false,
                        showPrevBtn: false,
                        normal: {
                            color: '#188df0',
                            borderColor: '#188df0'
                        },
                        emphasis: {
                            color: '#aaa',
                            borderColor: '#aaa'
                        }
                    },
                    data: years
                },
                grid:{
                    bottom:75
                },
                title : {
                    text: '',
                    textStyle:{
                        color:'#fff'
                    }
                },
                tooltip : {
                    trigger: 'axis'
                },
                legend: {
                    data:['上报数','结案数'],
                    textStyle:{
                        color:'#fff'
                    }
                },
                toolbox: {
                    show : true,
                    feature : {
                        dataView : {show: true, readOnly: false},
                        magicType : {show: true, type: ['line', 'bar']},
                        restore : {show: true},
                        saveAsImage : {show: true}
                    }
                },
                calculable : true,
                xAxis : [{
                    type : 'category',
                    data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
                    axisLine:{
                        lineStyle:{
                            color:'#fff',
                        }
                    }
                }],
                yAxis : [
                    {
                        type : 'value',
                        axisLine:{
                            lineStyle:{
                                color:'#fff',
                            }
                        }
                    }
                ],
            },
            options:monthData,

        };
         option3 = {
            title: {
                text: '部门工作总评',
                x: 'center',
                textStyle:{
                    color:'#fff'
                }
            },
            series: [{
                type: 'pie',
                center: ['50%', '50%'], // 居中设置
                radius: ['60%', '75%'], // 控制环形内半径和外半径
                data: [{
                    name: 'other',
                    value: 12,

                    itemStyle: {
                        normal: {
                            show: true,
                            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                offset: 0,
                                color: '#7049f0'
                            }, {
                                offset: 1,

                                color: '#9A32CD'
                            }]),
                            /*  barBorderRadius: 15,
                              borderWidth: 0,*/
                        }
                    },
                    label: {
                        show: true,
                        position: 'center',
                        formatter: '好评率',
                        textStyle: {
                            baseline: 'bottom',
                            fontSize: 20,
                            fontWeight: 'bold',
                            color:'#3ea1ff',
                        }
                    },
                    labelLine: {
                        show: false
                    }
                },
                    {
                        name: '好评数',
                        value: 88,
                        itemStyle: {
                            normal: {
                                /*     barBorderRadius: 15,*/
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1, [{
                                        offset: 1,
                                        color: '#00feff'
                                    },
                                        {
                                            offset: 0.5,
                                            color: '#027eff'
                                        },
                                        {
                                            offset: 0,
                                            color: '#0286ff'
                                        }
                                    ]
                                )
                            }
                        },
                        label: {
                            show: true,
                            position: 'center',
                            formatter: function(params) {
                                return params.value + '%'
                            },
                            textStyle: {
                                baseline: 'top',
                                fontSize: 20,
                                fontWeight: 'bold',
                                color:'#00feff',
                            }
                        },
                        labelLine: {
                            show: false
                        }
                    }
                ]
            }]
        };
         option4 = {
            backgroundColor: {
                type: 'pattern',
                image: canvas,
                repeat: 'repeat'
            },
            tooltip: {},
            title: [{
                text: '部门本月工作效率排名',
                x: '25%',
                textAlign: 'center',
                textStyle:{
                    color:'#fff'
                }

            }, {
                text: '部门本年工作效率排名',
                x: '75%',
                textAlign: 'center',
                textStyle:{
                    color:'#fff'
                }
            }],
            // grid: [{
            //     top: 50,
            //     width: '50%',
            //     bottom: '45%',
            //     left: 10,
            //     containLabel: true
            // }, {
            //     top: '55%',
            //     width: '50%',
            //     bottom: 0,
            //     left: 10,
            //     containLabel: true
            // }]
            // ,

            grid: [
                {x: '7%', y: '14%', width: '38%', height: '68%'},
                {x2: '7%', y: '14%', width: '38%', height: '68%'},
                // {x: '7%', y2: '7%', width: '38%', height: '38%'},
                // {x2: '7%', y2: '7%', width: '38%', height: '38%'}
            ],

            xAxis: [{
                type: 'value',

                max: builderJson.all,
                axisLine:{
                    lineStyle:{
                        color:'#fff'
                    }
                },
                splitLine: {
                    show: false

                }
            }, {
                type: 'value',

                max: builderJson.all,
                gridIndex: 1,
                axisLine:{
                    lineStyle:{
                        color:'#fff'
                    }
                },
                splitLine: {
                    show: false
                }
            }],
            yAxis: [{
                type: 'category',

                data: Object.keys(builderJson.charts),
                axisLabel: {
                    interval: 0,
                    rotate: 30
                },
                axisLine:{
                    lineStyle:{
                        color:'#fff'
                    }
                },
                splitLine: {
                    show: false
                }
            }, {
                gridIndex: 1,
                type: 'category',

                data: Object.keys(builderJson.components),
                axisLabel: {
                    interval: 0,
                    rotate: 30
                },
                axisLine:{
                    lineStyle:{
                        color:'#fff'
                    }
                },
                splitLine: {
                    show: false
                }
            }],
            series: [{
                type: 'bar',
                stack: 'chart',
                z: 3,
                label: {
                    normal: {
                        position: 'right',
                        show: true,
                        color:'#fff'
                    }
                },

                itemStyle: {
                    normal: {
                        /*     barBorderRadius: 15,*/
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 0, 1, [{
                                offset: 1,
                                color: '#00feff'
                            },
                                {
                                    offset: 0.5,
                                    color: '#027eff'
                                },
                                {
                                    offset: 0,
                                    color: '#0286ff'
                                }
                            ]
                        )
                    }
                },


                data: Object.keys(builderJson.charts).map(function(key) {
                    return builderJson.charts[key];
                })
            }, {
                type: 'bar',
                stack: 'chart',
                silent: true,
                itemStyle: {
                    normal: {
                        color: '#eee'
                    }
                },
                data: Object.keys(builderJson.charts).map(function(key) {
                    return builderJson.all - builderJson.charts[key];
                })
            }, {
                type: 'bar',
                stack: 'component',
                xAxisIndex: 1,
                yAxisIndex: 1,
                z: 3,
                label: {
                    normal: {
                        position: 'right',
                        show: true,
                        color:'#fff'
                    }
                },

                itemStyle: {
                    normal: {
                        show: true,
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: '#00b0ff'
                        }, {
                            offset: 1,

                            color: '#4CC76D'
                        }]),
                        /*  barBorderRadius: 15,
                          borderWidth: 0,*/
                    }
                },
                data: Object.keys(builderJson.components).map(function(key) {
                    return builderJson.components[key];
                })
            }, {
                type: 'bar',
                stack: 'component',
                silent: true,
                xAxisIndex: 1,
                yAxisIndex: 1,
                itemStyle: {
                    normal: {
                        color: '#eee'
                    }
                },
                data: Object.keys(builderJson.components).map(function(key) {
                    return builderJson.all - builderJson.components[key];
                })
            }, ]
        }



        mychart1.setOption(option1);
        mychart2.setOption(option2);
        mychart3.setOption(option3);
        mychart4.setOption(option4);

        autoAction(mychart2,option2.baseOption.xAxis[0].data.length);
        countNumer();

        /*刷新数字*/
        count_number1.update(value.report_send);
        count_number2.update(value.report_accept);
        count_number3.update(value.report_over);
        count_number4.update(value.report_all);
    });


    $(".table-depart .layui-card-body ul li a").click(function () {
        id = $(this).attr("data-id");
        $.getJSON("/ajax/ShowAjax/depart_number","id="+id,function (data) {

            /*刷新饼图*/
            var option =  mychart1.getOption();
            option.series[0].data[0].value = data.report_over;
            option.series[0].data[1].value = data.report_send+data.report_accept;

            option.series[1].data[0].value = data.report_accept;
            option.series[1].data[1].value = data.report_send;

            option.series[2].data[0].value = data.report_over;
            option.series[2].data[1].value = data.report_send+data.report_accept;
            mychart1.setOption(option);


            /*刷新条形图*/
            years.forEach(function(item,i) {
                var send_month = [0,0,0,0,0,0,0,0,0,0,0,0];
                var over_month = [0,0,0,0,0,0,0,0,0,0,0,0];

                data.months['send_'+item].forEach(function(d){
                    send_month[d[0]-1] = d[1];
                });
                data.months['over_'+item].forEach(function(d){
                    over_month[d[0]-1] = d[1];
                });
                monthData[i].series[0].data = send_month;
                monthData[i].series[1].data = over_month;
                monthData.push({
                    series : [
                        {
                            name:'上报数',
                            type:'bar',
                            itemStyle: {
                                normal: {
                                    show: true,
                                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                        offset: 0,
                                        color: '#7049f0'
                                    }, {
                                        offset: 1,

                                        color: '#9A32CD'
                                    }]),
                                    /*  barBorderRadius: 15,
                                      borderWidth: 0,*/
                                }
                            },
                            data:send_month,
                            markPoint : {
                                data : [
                                    {type : 'max', name: '最大值'},
                                    {type : 'min', name: '最小值'}
                                ]
                            },
                            markLine : {
                                data : [
                                    {type : 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name:'结案数',
                            type:'bar',
                            itemStyle: {
                                normal: {
                                    /*     barBorderRadius: 15,*/
                                    color: new echarts.graphic.LinearGradient(
                                        0, 0, 0, 1, [{
                                            offset: 0,
                                            color: '#00feff'
                                        },
                                            {
                                                offset: 0.5,
                                                color: '#027eff'
                                            },
                                            {
                                                offset: 1,
                                                color: '#0286ff'
                                            }
                                        ]
                                    )
                                }
                            },
                            data:over_month,
                            markPoint : {
                                data : [
                                    {name : '年最高', value : 182.2, xAxis: 7, yAxis: 183},
                                    {name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
                                ]
                            },
                            markLine : {
                                data : [
                                    {type : 'average', name : '平均值'}
                                ]
                            }
                        }
                    ]
                })
            });
            option2 = {
                baseOption:{
                    timeline: {
                        axisType: 'category',
                        orient: 'horizontal',
                        autoPlay: true,
                        inverse: true,
                        playInterval: 40000,
                        label: {
                            show:true,

                            normal: {
                                position:'bottom',
                                textStyle: {
                                    color: '#fff'
                                }
                            },
                            emphasis: {
                                textStyle: {
                                    color: '#188df0'
                                }
                            }
                        },
                        symbol: 'none',
                        lineStyle: {
                            color: '#ddd'
                        },
                        checkpointStyle: {
                            color: '#fff',
                            borderColor: '#188df0',
                            borderWidth: 2
                        },
                        controlStyle: {
                            showNextBtn: false,
                            showPrevBtn: false,
                            normal: {
                                color: '#188df0',
                                borderColor: '#188df0'
                            },
                            emphasis: {
                                color: '#aaa',
                                borderColor: '#aaa'
                            }
                        },
                        data: years
                    },
                    grid:{
                        bottom:75
                    },
                    title : {
                        text: '',
                        textStyle:{
                            color:'#fff'
                        }
                    },
                    tooltip : {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['上报数','结案数'],
                        textStyle:{
                            color:'#fff'
                        }
                    },
                    toolbox: {
                        show : true,
                        feature : {
                            dataView : {show: true, readOnly: false},
                            magicType : {show: true, type: ['line', 'bar']},
                            restore : {show: true},
                            saveAsImage : {show: true}
                        }
                    },
                    calculable : true,
                    xAxis : [{
                        type : 'category',
                        data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
                        axisLine:{
                            lineStyle:{
                                color:'#fff',
                            }
                        }
                    }],
                    yAxis : [
                        {
                            type : 'value',
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                }
                            }
                        }
                    ],
                },
                options:monthData,

            };
            mychart2.setOption(option2,true);


            /*刷新数字*/
            count_number1.update(data.report_send);
            count_number2.update(data.report_accept);
            count_number3.update(data.report_over);
            count_number4.update(data.report_all);
        });
    });


    setInterval(function () {

        $.getJSON(url,"id="+id,function (data) {

            /*刷新饼图*/
            var option =  mychart1.getOption();
            option.series[0].data[0].value = data.report_over;
            option.series[0].data[1].value = data.report_send+data.report_accept;

            option.series[1].data[0].value = data.report_accept;
            option.series[1].data[1].value = data.report_send;

            option.series[2].data[0].value = data.report_over;
            option.series[2].data[1].value = data.report_send+data.report_accept;
            mychart1.setOption(option);

            /*刷新条形图*/
            years.forEach(function(item,i) {
                var send_month = [0,0,0,0,0,0,0,0,0,0,0,0];
                var over_month = [0,0,0,0,0,0,0,0,0,0,0,0];

                data.months['send_'+item].forEach(function(d){
                    send_month[d[0]-1] = d[1];
                });
                data.months['over_'+item].forEach(function(d){
                    over_month[d[0]-1] = d[1];
                });
                monthData[i].series[0].data = send_month;
                monthData[i].series[1].data = over_month;
                monthData.push({
                    series : [
                        {
                            name:'上报数',
                            type:'bar',
                            itemStyle: {
                                normal: {
                                    show: true,
                                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                        offset: 0,
                                        color: '#7049f0'
                                    }, {
                                        offset: 1,

                                        color: '#9A32CD'
                                    }]),
                                    /*  barBorderRadius: 15,
                                      borderWidth: 0,*/
                                }
                            },
                            data:send_month,
                            markPoint : {
                                data : [
                                    {type : 'max', name: '最大值'},
                                    {type : 'min', name: '最小值'}
                                ]
                            },
                            markLine : {
                                data : [
                                    {type : 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name:'结案数',
                            type:'bar',
                            itemStyle: {
                                normal: {
                                    /*     barBorderRadius: 15,*/
                                    color: new echarts.graphic.LinearGradient(
                                        0, 0, 0, 1, [{
                                            offset: 0,
                                            color: '#00feff'
                                        },
                                            {
                                                offset: 0.5,
                                                color: '#027eff'
                                            },
                                            {
                                                offset: 1,
                                                color: '#0286ff'
                                            }
                                        ]
                                    )
                                }
                            },
                            data:over_month,
                            markPoint : {
                                data : [
                                    {name : '年最高', value : 182.2, xAxis: 7, yAxis: 183},
                                    {name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
                                ]
                            },
                            markLine : {
                                data : [
                                    {type : 'average', name : '平均值'}
                                ]
                            }
                        }
                    ]
                })
            });
            option2 = {
                baseOption:{
                    timeline: {
                        axisType: 'category',
                        orient: 'horizontal',
                        autoPlay: true,
                        inverse: true,
                        playInterval: 40000,
                        label: {
                            show:true,

                            normal: {
                                position:'bottom',
                                textStyle: {
                                    color: '#fff'
                                }
                            },
                            emphasis: {
                                textStyle: {
                                    color: '#188df0'
                                }
                            }
                        },
                        symbol: 'none',
                        lineStyle: {
                            color: '#ddd'
                        },
                        checkpointStyle: {
                            color: '#fff',
                            borderColor: '#188df0',
                            borderWidth: 2
                        },
                        controlStyle: {
                            showNextBtn: false,
                            showPrevBtn: false,
                            normal: {
                                color: '#188df0',
                                borderColor: '#188df0'
                            },
                            emphasis: {
                                color: '#aaa',
                                borderColor: '#aaa'
                            }
                        },
                        data: years
                    },
                    grid:{
                        bottom:75
                    },
                    title : {
                        text: '',
                        textStyle:{
                            color:'#fff'
                        }
                    },
                    tooltip : {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['上报数','结案数'],
                        textStyle:{
                            color:'#fff'
                        }
                    },
                    toolbox: {
                        show : true,
                        feature : {
                            dataView : {show: true, readOnly: false},
                            magicType : {show: true, type: ['line', 'bar']},
                            restore : {show: true},
                            saveAsImage : {show: true}
                        }
                    },
                    calculable : true,
                    xAxis : [{
                        type : 'category',
                        data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
                        axisLine:{
                            lineStyle:{
                                color:'#fff',
                            }
                        }
                    }],
                    yAxis : [
                        {
                            type : 'value',
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                }
                            }
                        }
                    ],
                },
                options:monthData,

            };
            mychart2.setOption(option2,true);



            /*刷新数字*/
            count_number1.update(data.report_send);
            count_number2.update(data.report_accept);
            count_number3.update(data.report_over);
            count_number4.update(data.report_all);
        });

        //更新右侧圆的数据
        $.getJSON(urlGood,function (params) {
            var option =  mychart3.getOption();
            option.series[0].data[0].value = params.good;
            option.series[0].data[1].value = params.noGood;

            mychart3.setOption(option);
        });

    },80000);


});

$(window).resize(function(){
    mychart1.resize();
    mychart2.resize();
    mychart3.resize();
    mychart4.resize();
});
